A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in Web Application.
Themes are made up of a set of elements: skins, cascading style sheet (css), images, and other resources.
Themes are defined in special directories in your Website on your Web server. Each theme is a different subfolder of the \App_Themes folder.
MyWebSite à Website name
App_Themes à Folder that contains Themes
Theme1 Ã Theme Folder
SkinFile.skin à SkinFile name
StyleSheet.css à StyleSheet File Name
How to create Theme?
Skins
A skin file has the file name with extension .skin and contains property settings for individual control such as Button, TextBox, Calendar or Label controls. You create skin files in the theme folder.
<asp:Button runat="server" BackColor="Red" ForeColor="White" />
Cascading Style Sheets
A theme can also include a cascading style sheet (.css file). When you put a .css file in the theme folder, the style sheet is applied automatically as a part of the theme. You define a style sheet using a file name extension .css in the theme folder.
body {
background-color: #2C2C2C; }
How to Apply Theme?
You can apply themes to a page or a Web site.
To apply a theme to a Web site
Add code in web.config file
<system.web>
<pages theme="Theme1"></pages> //Theme1 is the name of the Theme
</system.web>
To apply a theme to an individual page
Add code in page directive
<%@ Page Theme="Theme1" %> //Theme1 is the name of the Theme
To apply a theme to an individual page dynamically
protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "Theme1"; // Theme1 is the name of the theme
}
Anonymous User
19-Jun-2019Thanks for sharing the information.